package com.wuxiaoqin.admin.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaoqin.admin.entity.Address;
import com.wuxiaoqin.admin.entity.Ordergood;
import com.wuxiaoqin.admin.entity.Orders;
import com.wuxiaoqin.admin.service.IAddressService;
import com.wuxiaoqin.admin.service.IOrdersService;
import com.wuxiaoqin.uitls.respObj.RespBean;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2021-11-17
 */
@RestController
@RequestMapping("/orders")
public class OrdersController {
    @Autowired
    private IOrdersService ordersService;

    @ApiOperation(value = "获取订单列表")
    @GetMapping("/getOrders")
    public List<Orders> getAllOrders(){
        return ordersService.getAllOrders();
    }

    @ApiOperation(value = "获取未处理订单列表")
    @GetMapping("/getNoProcessOrders")
    public List<Orders> getNoProcessOrders(){
        return ordersService.getNoProcessOrders();
    }
    @ApiOperation(value = "获取未处理订单列表个数")
    @GetMapping("/getCount")
    public Integer getCount(){
        return ordersService.getCount();
    }
    @ApiOperation(value = "处理订单，使其成为已支付，已发货状态")
    @PostMapping("/ordersToFahuo")
    public RespBean ordersToFahuo(@RequestParam("orderid") Integer orderNo){
        return ordersService.ordersToFahuo(orderNo);
    }


    @ApiOperation(value = "获取订单商品项")
    @GetMapping("/getOrderItem")
    public RespBean getOrderItem(@RequestParam("orderid") Integer orderNo){
        return ordersService.getOrderItem(orderNo);
    }


    @ApiOperation(value = "按订单编号查询订单")
    @PostMapping("/orderById")
    public RespBean orderById(@RequestParam("orderid") Integer orderNo){
        return ordersService.orderById(orderNo);
    }
}
